function [Xfunc_mean_beta] = compute_mean_Xfunc_times_beta(dims, Xparts, myfunc, params_parts)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Inputs:
	% dims:					object
	% Xparts:				cell(NumParts,1)
	%   {ii}:					object
	%		.X:						dim1_ii x NumX
	%		.X_FEs:					dim1_ii x NumX_FEs
	% myfunc:				function
	% params_parts:			cell(NumParts,1)
	%	{kk}:					object
	%		.beta:					NumX x 1
	%		.FE_vals:				cell(NumX_FEs, 1)
	%			{ii}:					NumFE_vals_ii x 1
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Outputs:
	% 
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	NumParts = length(Xparts);
	
	% Compute Xfunc_mean_parts
	Xfunc_mean_parts = compute_mean_Xfunc(Xparts, myfunc);
	
	% Multiply each by corresponding beta coef
	Xfunc_mean_beta_parts = cell(NumParts,1);
	for pp = 1:NumParts
		Xfunc_mean_beta_parts{pp}.X_Y = Xfunc_mean_parts{pp}.X' .* params_parts{pp}.beta; % NumX x 1
		
		NumFEs = size(Xparts{pp}.X_FEs,2);
		X_FEs_Y = cell(NumFEs,1);
		for ff = 1:NumFEs
			X_FEs_Y{ff} = Xfunc_mean_parts{pp}.X_FEs{ff} .* params_parts{pp}.FE_vals{ff};
		end
		Xfunc_mean_beta_parts{pp}.X_FEs_Y = X_FEs_Y;
	end
	Xfunc_mean_beta = split_combine_parts(dims, 3, Xfunc_mean_beta_parts); % 1 x NumParams
end
